package com.general.demo.bulkhead;

import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;

import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER;

/**
 * @description: BulkheadFilter
 * @author: general
 * @version: 1.0
 * @create: 2021-09-05 16:20
 **/
@Activate(group = PROVIDER, value = "bulkhead")
public class BulkheadFilter implements Filter {


    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
//        System.err.println("enter com.general.demo.bulkhead.BulkheadFilter.invoke ...");
        BulkheadFactory instance = BulkheadFactory.getInstance();
        return instance.getBulkheadResult(invoker, invocation);
    }
}
